<?php
/**
  *  Project name: project_name
  *  Created on: 08.12.2011
  *  Author: Kai R�der
  */
/**********************************************
 * 
 * Database configuration
 * 
 **********************************************/
if(!$sql)
{
    include("../../class/sql/class.sql.php");
    $connArgs = array(
                                            "mysql:host=localhost;dbname=kssystem", // Connection
                                            "kssystem", 							// User
                                            "foobar",									// Password
                                            array()								// Options
                                    );

    // Connection handle
     $sql = new CSql($connArgs);

    // Set db-charset to utf8
    $sql->query("SET NAMES utf8");
    $sql->query("SET CHARACTER SET utf8");
}

$idFiliale = $_GET['idFiliale'];
if(!$idFiliale) $idFiliale = $eIdFiliale;

$gstelle = $sql->prepare("SELECT * FROM Gstelle WHERE filialeId = ?");
$gstelle->execute(array($idFiliale));


$options = "";

$options.= "<option value='null'>Keine Auswahl</option>";
foreach($gstelle as $g)
{
    if($eIdGstelle == $g['idGstelle']) { $checked = "selected='selected'"; } else { unset($checked); }
    $options.= "<option value='" . $g['idGstelle'] . "' $checked>[" . $g['kurzel'] . "] " . utf8_decode($g['bezeichnung']) . "</option>";
}
echo $options;
?>